LoginSignup
14
13

More than 1 year has passed since last update.

RemiでCentOS7にPHP8をインストールする

Last updated at Posted at 2021-07-18

Remi(=CentOSのサードパーティーリポジトリ)を使って、CentOS7にPHP8をインストールしたので覚え書き。

環境

  • OS: CentOS7.9(GCP・Compute EngineのCentOS)
  • PHP: 8.0.8(インストール後)

手順

ほぼ、
Remi's RPM repository - Configuration wizard | rpms.remirepo.net
の通り

上記ページの、Operation system and version selection の欄で、以下の通り選択しました。
image.png

(1) まず、Remiの使用に必要なEPEL(=標準リポジトリでは提供されないパッケージの使用を可能にする)をインストールします。

$ sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

(2) Remiレポジトリの構成パッケージをインストール

$ sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm

(3) yum-config-managerコマンドの使用に必要なyum-utilsパッケージをインストール

$ sudo yum install -y yum-utils

(4) PHP8.0のパッケージのみを有効にします

$ sudo yum-config-manager --disable 'remi-php*'
$ sudo yum-config-manager --enable remi-php80

(5) 使用可能なレポジトリの確認。「remi-php80」が表示されればOKです。

$ sudo yum repolist

(6) インストールパッケージの最新化を実施

$ sudo yum update -y

※GCPで、以下の状態でしばらく待ちになった場合は、「Ctrl + C」で中断してしまっても大丈夫です(直後、エラーになりましたが、先に進めました)。

Running transaction
  Updating   : google-cloud-sdk-348.0.0-1.x86_64

(7) PHPをインストール。

$ sudo yum install -y php

※サイトの手順では、「php-xxx」となっていますが、「-xxx」は不要でした。

(8) 以下のコマンドを実行し、PHPのバージョンが表示されればOK

$ php --version

メモ

地味に、手順(7)のところでハマった。
php-80とか、remi-php80ではなく、単にphpとするのが正解(他のバージョンを無効にしてるからかもですが)

参考

14
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
13